
// 组件的逻辑复用
import  {mapGetters}   from  'vuex'
export default {
  data(){
    return {
      msg:'hello world'
    }
  },
  computed:{
    ...mapGetters('cart',['total'])
  },
  watch:{
    total:{
      handler(newVal){
        uni.setTabBarBadge({
          index: 2,
          text: this.total+''
        })
      },
      immediate:true
    }
  },
  onShow() {
    console.log(this.total,88);
    uni.setTabBarBadge({
      index: 2,
      text: this.total+''
    })
  },
}